class Solution {
public:
    string convertToTitle(int n) {
        string ans="";
        while(n>0){
            n-=1;
            ans+=('A'+n%26);
            n/=26;
        }
        std::reverse(ans.begin(),ans.end());
        return ans;
    }
};